{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% origin %}
{% load ietf_filters ballot_icon person_filters %}
<td class="status bg-transparent">
    <div class="float-end ms-1 mb-1" id="ballot-icon-{{ doc.name }}">{% ballot_icon doc %}</div>
    {% if not doc.type_id == "rfc" %}
        {% if '::' in doc.friendly_state %}
            {{ doc.friendly_state|safe }}
        {% else %}
            {{ doc.friendly_state|safe }}
        {% endif %}
        {% if doc|state:"draft-rfceditor" %}
            : <a href="https://www.rfc-editor.org/queue2.html#{{ doc.name }}">{{ doc|state:"draft-rfceditor" }}</a>
        {% endif %}
        {{ doc|auth48_alert_badge }}
        {{ doc|state_age_colored }}
        {% if doc.telechat_date %}
            <br>
            IESG telechat: {{ doc.telechat_date }}
        {% endif %}
        {% with doc.active_defer_event as defer %}
            {% if defer %}
                <br>
                Deferred by {{ defer.by }} on {{ defer.time|date:"Y-m-d" }})
            {% endif %}
        {% endwith %}
        {% if doc.stream %}
            <br>
            {% if doc|state:"stream" %}
                {{ doc|state:"stream" }}
                {% if doc.intended_std_level %}
                    :
                {% endif %}
            {% else %}
                {{ doc.stream }} stream
                {% if doc.intended_std_level %}
                    :
                {% endif %}
            {% endif %}
        {% endif %}
        {% if doc.intended_std_level %}{{ doc.intended_std_level }}{% endif %}
        {% if doc.duedate %}
            <br>
            Due date: {{ doc.duedate }}
        {% endif %}
        {% if doc.review_assignments %}
            <br>
            Review{{ doc.review_assignments|pluralize }}:
            {% for review_assignment in doc.review_assignments %}
                {% if review_assignment.state_id == "completed" or review_assignment.state_id == "part-completed" %}
                    <span title="{{ review_assignment.review_request.team.acronym|upper }} {{ review_assignment.review_request.type.name }} review {% if review_assignment.reviewed_rev and review_assignment.reviewed_rev != current_rev or review_assignment.review_request.doc.name != current_doc_name %}of {% if review_assignment.review_request.doc.name != current_doc_name %}{{ review_assignment.review_request.doc.name }}{% endif %}-{{ review_assignment.reviewed_rev }}{% endif %}: {{review_assignment.result}}"
                    class="badge rounded-pill {% if review_assignment.result.name|slice:5|slugify == 'ready' %}text-bg-success{% elif review_assignment.result.name|slice:9|slugify == 'not-ready' %}text-bg-danger{% elif review_assignment.result.name|slice:10|slugify == 'has-issues' %}text-bg-warning{% else %}text-bg-info{% endif %}">
                    {% else %}
                        <span title="Incomplete, due {{ review_assignment.review_request.deadline|date:"Y-m-d" }}" class="badge rounded-pill text-bg-secondary">
                    {% endif %}
                    <a class="text-reset text-decoration-none" href="{% if review_assignment.review %}{% url 'ietf.doc.views_doc.document_main' review_assignment.review.name %}{% else %}{% url 'ietf.doc.views_review.review_request' review_assignment.review_request.doc.name review_assignment.review_request.pk %}{% endif %}">
                        {{ review_assignment.review_request.team.acronym }}
                        {% if review_assignment.review_request.type|slugify == "last-call" %}
                            LC
                        {% elif review_assignment.review_request.type|slugify != "telechat" %}
                            {{ review_assignment.review_request.type }}
                        {% endif %}
                    </a>
                    </span>

            {% endfor %}
        {% endif %}
        {% for m in doc.milestones %}
            {% if forloop.first %}<br>{% endif %}
            <span title="Part of {{ m.group.acronym }} milestone: {{ m.desc }}"
                  class="milestone">{{ m.due|date:"M Y" }}</span>{% if not forloop.last %},{% endif %}
        {% endfor %}
        {% if doc.action_holders_enabled and doc.action_holders.exists %}
            <br>
            Action Holder{{ doc.documentactionholder_set.all|pluralize }}:
            {% for action_holder in doc.documentactionholder_set.all %}
                {% person_link action_holder.person title=action_holder.role_for_doc %}{% if action_holder|action_holder_badge %} {{ action_holder|action_holder_badge }}{% endif %}{% if not forloop.last %},{% endif %}
            {% endfor %}
        {% endif %}
        {% if doc|is_unexpected_wg_state %}
            <br>
            <span class="badge rounded-pill text-bg-warning">Unexpected WG state</span>
        {% endif %}
    {% else %}
        {# RFC #}
        {{ doc.std_level|safe }} RFC
        {% if doc.obsoleted_by_list %}
            <br>
            <span class="text-body-secondary">Obsoleted by {{ doc.obsoleted_by_list|join:", "|urlize_ietf_docs }}</span>
        {% endif %}
        {% if doc.updated_by_list %}
            <br>
            <span class="text-body-secondary">Updated by {{ doc.updated_by_list|join:", "|urlize_ietf_docs }}</span>
        {% endif %}
        {% if doc.part_of %}
            <br>
            <span class="text-body-secondary">{% for sub in doc.part_of %}{% if sub.contains|length_is:"1" %} Also known as {% else %} Part of {% endif %}<a href="{% url 'ietf.doc.views_doc.document_main' name=sub.name%}">{{sub.name|slice:":3"|upper}} {{sub.name|slice:"3:"}}</a>{% if not forloop.last %}, {%endif%}{% endfor %}</span>
        {% endif %}
    {% endif %}
</td>